package boot

import (
	"github.com/gogf/gf/os/gcache"
	"github.com/gogf/gf/os/glog"
	"github.com/gogf/gf/util/gconv"
	"github.com/robfig/cron"
)

func init(){
	go myCron()
}

func myCron() {
	c := cron.New()
	spec := "*/5 * * * * ?"  // 秒，分，时，日，月，星期，年
	c.AddFunc(spec, func(){
		flag := gcache.Contains("testParams")
		text := gconv.String(gcache.Get("testParams"))
		glog.Infof("===== 我是计划任务 =====是否存在:%t 值:%s \r\n", flag, text)
	})

	c.Start()

	select {
	}
}